package org.mobilesynergies.epic.service.java;

import org.mobilesynergies.epic.client.EpicCommand;
import org.mobilesynergies.epic.client.parameter.BooleanParameter;
import org.mobilesynergies.epic.client.parameter.FloatParameter;
import org.mobilesynergies.epic.client.parameter.IntParameter;
import org.mobilesynergies.epic.client.parameter.ParameterMap;
import org.mobilesynergies.epic.client.parameter.StringParameter;

public class MyInfiniteCommandLoop extends EpicCommand{

	@Override
	public String getHumanReadableName() {
		return "Super cool infinite command loop";
	}

	@Override
	public String getId() {
		return "MyInfiniteCommandLoop";
	}

	@Override
	public boolean hasPermission(String jid) {
		return true;
	}

	@Override
	public void cancel() {
	}

	@Override
	public void finalize(ParameterMap response) {
	}

	@Override
	public ParameterMap initialize() {
		IntParameter intparam = new IntParameter(50, 0, 100, 1);
		ParameterMap map = new ParameterMap();
		map.putParameter("my int param", intparam);
		return map;
	}

	@Override
	public boolean isLastStage() {
		//always return false (it is a infinite loop)
		return false;
	}

	@Override
	public ParameterMap nextStage(ParameterMap response) {
		if(response.containsKey("my int param")){
			System.out.println("my int param: "+ String.valueOf(response.getInt("my int param")));
		}
		return initialize();

	}

	@Override
	public void previousStage() {
	}


}